import { http } from "@/utils/http";
import type { TableItem } from "./type";
type ResultTable = {
  total?: number;
  data?: Array<any>;
};

//根据typeCode和itemValue查询子项
export const verificationPlanqueryRunData = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/queryRunData`, {
    data
  });
};

//验证计划 查询列表
export const planqueryListPage = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/queryListPage`, {
    data
  });
};

//验证计划 数据分析
export const plandataAnalysis = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/dataAnalysisV2`, {
    data
  });
};

//验证计划 实验计划名称list
export const planqueryPlanNameList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/queryPlanNameList`, {
    data
  });
};

//验证计划 新增
export const planadd = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/add`, {
    data
  });
};

//验证计划 执行
export const planexecute = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/execute`, {
    data
  });
};

//验证计划 查询详情
export const planqueryDetail = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/queryDetail`, {
    data
  });
};

//验证计划 修改
export const planupdate = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/update`, {
    data
  });
};

//验证计划 删除
export const plandelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/plan/delete`, {
    data
  });
};

//仪表排期 仪表日程
export const schedulequeryEqpDetail = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryEqpDetail`, {
    data
  });
};

//仪仪器排期 仪表排期列表
export const schedulequeryLatestScheduleListPage = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryLatestScheduleListPage`, {
    data
  });
};

//仪仪器排期 仪表排期列表new
export const schedulequeryScheduleListPageV2 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryScheduleListPageV2  `, {
    data
  });
};

//仪器排期 新增
export const scheduleadd = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/add`, {
    data
  });
};

//仪器排期 删除
export const scheduledelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/delete`, {
    data
  });
};

//仪器排期 编辑
export const scheduleupdate = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/update`, {
    data
  });
};

//仪器排期 仪表排期弹窗列表
export const schedulequeryEqpScheduleList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryEqpScheduleList`, {
    data
  });
};

//仪表排期获取名称列表
export const schedulequeryScheduleEqpName = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryScheduleEqpName`, {
    data
  });
};

//仪表排期获取code列表
export const schedulequeryScheduleEqpCode = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryScheduleEqpCode`, {
    data
  });
};

//指标树-查询(科室)
export const measurequeryMeasureList = (data?: object) => {
  return http.request<ResultTable>("post", `/account/api/v1/publish/measure/queryMeasureList`, {
    data
  });
};

//验证计划 上传数据
export const planuploadData = (data?: object | undefined, cb?: (err: any) => any) =>
  http.request<Array<TableItem>>(
    "post",
    `/operation/api/v1/water/verification/plan/uploadData`,
    { data },
    { headers: { noLoading: true, "Content-Type": "multipart/form-data" } },
    cb
  );

//数据分析 查询手动上传指标数据
export const dataAnalysisqueryUploadDataDetail = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/dataAnalysis/queryUploadDataDetail`, {
    data
  });
};
//获取前一次保存的自定义仪表信息
export const schedulequeryPreCustomizeEqpInfo = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/verification/schedule/queryPreCustomizeEqpInfo`, {
    data
  });
};
